home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.19950929-19951130 / 000264_news@columbia.edu_Wed Nov 1 16:05:39 1995.msg < prev    next >
Internet Message Format  |  2020-01-01  |  2KB

  1. Received: from apakabar.cc.columbia.edu by watsun.cc.columbia.edu with SMTP id AA09846
  2.   (5.65c+CU/IDA-1.4.4/HLK for <kermit.misc@watsun.cc.columbia.edu>); Wed, 1 Nov 1995 11:05:50 -0500
  3. Received: by apakabar.cc.columbia.edu id AA29929
  4.   (5.65c+CU/IDA-1.4.4/HLK for kermit.misc@watsun); Wed, 1 Nov 1995 11:05:49 -0500
  5. Path: news.columbia.edu!watsun.cc.columbia.edu!fdc
  6. From: fdc@watsun.cc.columbia.edu (Frank da Cruz)
  7. Newsgroups: comp.protocols.kermit.misc
  8. Subject: Re: how to assign output of command to variable
  9. Date: 1 Nov 1995 16:05:39 GMT
  10. Organization: Columbia University
  11. Lines: 31
  12. Message-Id: <4785sj$t74@apakabar.cc.columbia.edu>
  13. References: <4749uf$cr4@vodka.intele.net>
  14. Nntp-Posting-Host: watsun.cc.columbia.edu
  15. Apparently-To: kermit.misc@watsun.cc.columbia.edu
  16.  
  17. In article <4749uf$cr4@vodka.intele.net>,
  18. Gerry Jensen <gerry@blue.intele.net> wrote:
  19. : I am trying to write a Kermit script file for ckermit on a Unix system. 
  20. : I wish to assign the output from a Unix command to a variable similar 
  21. : to the following sh-style command:
  22. :    SomeVar=`ls`
  23. : Is it possible to do something like this in a Kermit script? Something 
  24. : like:
  25. :   
  26. :    define \%a run ls ; (i know this doesn't work)
  27. : i.e. assign the output from the ls command to the variable \%a ?
  28. Yes:
  29.  
  30.   open !read <command>
  31.   :LOOP
  32.   read \%a             ; Reads a line from output of the command
  33.   if fail goto done    ; This happens when the <command> exits
  34.  
  35.   ; Here do whatever you want to do with the line
  36.  
  37.   goto loop
  38.   :DONE
  39.  
  40. In the example above, replace <command> by whatever command you want
  41. to execute.  See pages 269-272 of "Using C-Kermit" for details.
  42.  
  43. - Frank